--
-- PostgreSQL database dump
--

-- Started on 2009-10-30 16:46:58

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 314 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1506 (class 1259 OID 16430)
-- Dependencies: 3
-- Name: discovery; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE discovery (
    id integer NOT NULL,
    monitor_id integer NOT NULL,
    content text
);


ALTER TABLE public.discovery OWNER TO postgres;

--
-- TOC entry 1505 (class 1259 OID 16428)
-- Dependencies: 1506 3
-- Name: discovery_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE discovery_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.discovery_id_seq OWNER TO postgres;

--
-- TOC entry 1800 (class 0 OID 0)
-- Dependencies: 1505
-- Name: discovery_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE discovery_id_seq OWNED BY discovery.id;


--
-- TOC entry 1504 (class 1259 OID 16414)
-- Dependencies: 3
-- Name: monitors; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE monitors (
    id integer NOT NULL,
    url character varying(1023) NOT NULL,
    user_id integer,
    status character varying(255) NOT NULL
);


ALTER TABLE public.monitors OWNER TO postgres;

--
-- TOC entry 1503 (class 1259 OID 16412)
-- Dependencies: 3 1504
-- Name: monitors_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE monitors_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.monitors_id_seq OWNER TO postgres;

--
-- TOC entry 1801 (class 0 OID 0)
-- Dependencies: 1503
-- Name: monitors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE monitors_id_seq OWNED BY monitors.id;


--
-- TOC entry 1502 (class 1259 OID 16403)
-- Dependencies: 3
-- Name: users; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE users (
    id integer NOT NULL,
    login character varying(255) NOT NULL,
    password character varying(255) NOT NULL,
    name character varying(255),
    surname character varying(255),
    email character varying(255)
);


ALTER TABLE public.users OWNER TO postgres;

--
-- TOC entry 1501 (class 1259 OID 16401)
-- Dependencies: 3 1502
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.users_id_seq OWNER TO postgres;

--
-- TOC entry 1802 (class 0 OID 0)
-- Dependencies: 1501
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE users_id_seq OWNED BY users.id;


--
-- TOC entry 1786 (class 2604 OID 16433)
-- Dependencies: 1506 1505 1506
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE discovery ALTER COLUMN id SET DEFAULT nextval('discovery_id_seq'::regclass);


--
-- TOC entry 1785 (class 2604 OID 16417)
-- Dependencies: 1504 1503 1504
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE monitors ALTER COLUMN id SET DEFAULT nextval('monitors_id_seq'::regclass);


--
-- TOC entry 1784 (class 2604 OID 16406)
-- Dependencies: 1501 1502 1502
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);


--
-- TOC entry 1792 (class 2606 OID 16438)
-- Dependencies: 1506 1506
-- Name: pk_discovery; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY discovery
    ADD CONSTRAINT pk_discovery PRIMARY KEY (id);


--
-- TOC entry 1790 (class 2606 OID 16422)
-- Dependencies: 1504 1504
-- Name: pk_monitors; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY monitors
    ADD CONSTRAINT pk_monitors PRIMARY KEY (id);


--
-- TOC entry 1788 (class 2606 OID 16411)
-- Dependencies: 1502 1502
-- Name: pk_users; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY users
    ADD CONSTRAINT pk_users PRIMARY KEY (id);


--
-- TOC entry 1794 (class 2606 OID 16439)
-- Dependencies: 1789 1504 1506
-- Name: fk_monitors; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY discovery
    ADD CONSTRAINT fk_monitors FOREIGN KEY (monitor_id) REFERENCES monitors(id);


--
-- TOC entry 1793 (class 2606 OID 16423)
-- Dependencies: 1504 1787 1502
-- Name: fk_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY monitors
    ADD CONSTRAINT fk_users FOREIGN KEY (user_id) REFERENCES users(id);


--
-- TOC entry 1799 (class 0 OID 0)
-- Dependencies: 3
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2009-10-30 16:46:58

--
-- PostgreSQL database dump complete
--

